<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>一个有趣的傅里叶动画 | GLIMMER小作坊的工具人</title>
    <meta name="description" content="时间太瘦，指尖太宽，且行且珍惜">
    <meta name="generator" content="VuePress 1.4.0">
    <link rel="icon" href="/vuepress/image.png">
  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
  <script language="javascript" type="text/javascript" src="https://cdn.staticfile.org/jquery/1.7.2/jquery.min.js"></script>
  <script language="javascript" type="text/javascript" src="/js/MouseClickEffect.js"></script>
    
    <link rel="preload" href="/assets/css/0.styles.7c2ddbea.css" as="style"><link rel="preload" href="/assets/js/app.c1719760.js" as="script"><link rel="preload" href="/assets/js/5.882ae477.js" as="script"><link rel="preload" href="/assets/js/1.ad2741e3.js" as="script"><link rel="preload" href="/assets/js/2.b0f5b6a6.js" as="script"><link rel="preload" href="/assets/js/98.7bb55507.js" as="script"><link rel="preload" href="/assets/js/20.a8dae886.js" as="script"><link rel="prefetch" href="/assets/js/10.061af50f.js"><link rel="prefetch" href="/assets/js/100.85317b0d.js"><link rel="prefetch" href="/assets/js/101.8b7e5f17.js"><link rel="prefetch" href="/assets/js/102.724e3dd3.js"><link rel="prefetch" href="/assets/js/103.bfb1dc09.js"><link rel="prefetch" href="/assets/js/104.bc172956.js"><link rel="prefetch" href="/assets/js/105.dd66d16a.js"><link rel="prefetch" href="/assets/js/106.934eb59f.js"><link rel="prefetch" href="/assets/js/107.6f0b24bd.js"><link rel="prefetch" href="/assets/js/108.1e5abf7c.js"><link rel="prefetch" href="/assets/js/109.0b133847.js"><link rel="prefetch" href="/assets/js/11.c1bf9f21.js"><link rel="prefetch" href="/assets/js/110.4452fac4.js"><link rel="prefetch" href="/assets/js/111.8dbe7cfe.js"><link rel="prefetch" href="/assets/js/112.a2640d20.js"><link rel="prefetch" href="/assets/js/113.1776625c.js"><link rel="prefetch" href="/assets/js/114.b2f2dd05.js"><link rel="prefetch" href="/assets/js/115.4c5e3507.js"><link rel="prefetch" href="/assets/js/116.55246e31.js"><link rel="prefetch" href="/assets/js/117.73fbc87f.js"><link rel="prefetch" href="/assets/js/118.64a28e52.js"><link rel="prefetch" href="/assets/js/119.eb809170.js"><link rel="prefetch" href="/assets/js/12.50fe0adf.js"><link rel="prefetch" href="/assets/js/120.103458ff.js"><link rel="prefetch" href="/assets/js/121.ce43023f.js"><link rel="prefetch" href="/assets/js/122.9ccdb852.js"><link rel="prefetch" href="/assets/js/123.61815387.js"><link rel="prefetch" href="/assets/js/124.08e66733.js"><link rel="prefetch" href="/assets/js/125.8057f00b.js"><link rel="prefetch" href="/assets/js/126.31a70f61.js"><link rel="prefetch" href="/assets/js/127.3b67b02c.js"><link rel="prefetch" href="/assets/js/128.b577a571.js"><link rel="prefetch" href="/assets/js/129.9d910324.js"><link rel="prefetch" href="/assets/js/13.a866e204.js"><link rel="prefetch" href="/assets/js/130.8aca0d81.js"><link rel="prefetch" href="/assets/js/131.ea811b09.js"><link rel="prefetch" href="/assets/js/132.76bfb2dc.js"><link rel="prefetch" href="/assets/js/133.a2c35376.js"><link rel="prefetch" href="/assets/js/134.06ae0a00.js"><link rel="prefetch" href="/assets/js/14.78f9cc08.js"><link rel="prefetch" href="/assets/js/15.d4060631.js"><link rel="prefetch" href="/assets/js/16.3434d0b6.js"><link rel="prefetch" href="/assets/js/17.eda8d321.js"><link rel="prefetch" href="/assets/js/18.bdd63861.js"><link rel="prefetch" href="/assets/js/19.fbd1cf33.js"><link rel="prefetch" href="/assets/js/21.b6f04af7.js"><link rel="prefetch" href="/assets/js/22.f7430b65.js"><link rel="prefetch" href="/assets/js/23.9ac373d9.js"><link rel="prefetch" href="/assets/js/24.e22a443a.js"><link rel="prefetch" href="/assets/js/25.36f2adb4.js"><link rel="prefetch" href="/assets/js/26.5c85b2c3.js"><link rel="prefetch" href="/assets/js/27.51c2e282.js"><link rel="prefetch" href="/assets/js/28.3b5555cb.js"><link rel="prefetch" href="/assets/js/29.f290854b.js"><link rel="prefetch" href="/assets/js/30.6495d68c.js"><link rel="prefetch" href="/assets/js/31.d2291244.js"><link rel="prefetch" href="/assets/js/32.67cb6a0b.js"><link rel="prefetch" href="/assets/js/33.ebac8658.js"><link rel="prefetch" href="/assets/js/34.b4056456.js"><link rel="prefetch" href="/assets/js/35.2d35ec45.js"><link rel="prefetch" href="/assets/js/36.6da1ac84.js"><link rel="prefetch" href="/assets/js/37.8d970d48.js"><link rel="prefetch" href="/assets/js/38.94dfd07f.js"><link rel="prefetch" href="/assets/js/39.b0e22253.js"><link rel="prefetch" href="/assets/js/40.a0e6dc1e.js"><link rel="prefetch" href="/assets/js/41.67345a28.js"><link rel="prefetch" href="/assets/js/42.bae9c869.js"><link rel="prefetch" href="/assets/js/43.d62be483.js"><link rel="prefetch" href="/assets/js/44.2efe511e.js"><link rel="prefetch" href="/assets/js/45.e44be0c9.js"><link rel="prefetch" href="/assets/js/46.429897b0.js"><link rel="prefetch" href="/assets/js/47.026450f6.js"><link rel="prefetch" href="/assets/js/48.1b6ac3b2.js"><link rel="prefetch" href="/assets/js/49.0d5de7d1.js"><link rel="prefetch" href="/assets/js/50.bcaa0633.js"><link rel="prefetch" href="/assets/js/51.bbe1f24b.js"><link rel="prefetch" href="/assets/js/52.4d4d4941.js"><link rel="prefetch" href="/assets/js/53.b3074dbb.js"><link rel="prefetch" href="/assets/js/54.7b51af21.js"><link rel="prefetch" href="/assets/js/55.4880a3a5.js"><link rel="prefetch" href="/assets/js/56.0fbaa129.js"><link rel="prefetch" href="/assets/js/57.fa32ec0f.js"><link rel="prefetch" href="/assets/js/58.3ab779c1.js"><link rel="prefetch" href="/assets/js/59.f7416e71.js"><link rel="prefetch" href="/assets/js/6.cfda4e49.js"><link rel="prefetch" href="/assets/js/60.f997e769.js"><link rel="prefetch" href="/assets/js/61.b6ce2d29.js"><link rel="prefetch" href="/assets/js/62.484e896b.js"><link rel="prefetch" href="/assets/js/63.7436e7b5.js"><link rel="prefetch" href="/assets/js/64.0af3fb9d.js"><link rel="prefetch" href="/assets/js/65.cc6b1063.js"><link rel="prefetch" href="/assets/js/66.b226aae4.js"><link rel="prefetch" href="/assets/js/67.23fa8790.js"><link rel="prefetch" href="/assets/js/68.fb8897ef.js"><link rel="prefetch" href="/assets/js/69.ca44c95b.js"><link rel="prefetch" href="/assets/js/7.4ce0026c.js"><link rel="prefetch" href="/assets/js/70.dc65b621.js"><link rel="prefetch" href="/assets/js/71.627c41f8.js"><link rel="prefetch" href="/assets/js/72.30703fc7.js"><link rel="prefetch" href="/assets/js/73.48afc079.js"><link rel="prefetch" href="/assets/js/74.1181783d.js"><link rel="prefetch" href="/assets/js/75.c70d8736.js"><link rel="prefetch" href="/assets/js/76.a2c7c0b4.js"><link rel="prefetch" href="/assets/js/77.ba42676c.js"><link rel="prefetch" href="/assets/js/78.1bdfbac5.js"><link rel="prefetch" href="/assets/js/79.5343f801.js"><link rel="prefetch" href="/assets/js/8.94e9fcf2.js"><link rel="prefetch" href="/assets/js/80.aaff9fb9.js"><link rel="prefetch" href="/assets/js/81.7855e1f9.js"><link rel="prefetch" href="/assets/js/82.a522f853.js"><link rel="prefetch" href="/assets/js/83.d417cbce.js"><link rel="prefetch" href="/assets/js/84.aa477229.js"><link rel="prefetch" href="/assets/js/85.737ceb08.js"><link rel="prefetch" href="/assets/js/86.76914c69.js"><link rel="prefetch" href="/assets/js/87.ca65d02a.js"><link rel="prefetch" href="/assets/js/88.ecd6fbe0.js"><link rel="prefetch" href="/assets/js/89.8321befc.js"><link rel="prefetch" href="/assets/js/9.8972d482.js"><link rel="prefetch" href="/assets/js/90.3130a41f.js"><link rel="prefetch" href="/assets/js/91.662fea10.js"><link rel="prefetch" href="/assets/js/92.afebfc2f.js"><link rel="prefetch" href="/assets/js/93.93c4872e.js"><link rel="prefetch" href="/assets/js/94.1ef96f22.js"><link rel="prefetch" href="/assets/js/95.76a35ecf.js"><link rel="prefetch" href="/assets/js/96.afd7ca1a.js"><link rel="prefetch" href="/assets/js/97.e5ffb86e.js"><link rel="prefetch" href="/assets/js/99.4ded3fca.js"><link rel="prefetch" href="/assets/js/vendors~flowchart.b04affb9.js">
    <link rel="stylesheet" href="/assets/css/0.styles.7c2ddbea.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div><div class="theme-container" data-v-4d80cb8a><div data-v-4d80cb8a><div id="loader-wrapper" class="loading-wrapper" data-v-4b73742e data-v-4d80cb8a data-v-4d80cb8a><div class="loader-main" data-v-4b73742e><div data-v-4b73742e></div><div data-v-4b73742e></div><div data-v-4b73742e></div><div data-v-4b73742e></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-0b619cf4 data-v-4d80cb8a data-v-4d80cb8a><h3 class="title" style="display:none;" data-v-0b619cf4 data-v-0b619cf4>GLIMMER小作坊的工具人</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-0b619cf4 data-v-0b619cf4><input type="password" value="" data-v-0b619cf4> <span data-v-0b619cf4>Konck! Knock!</span> <button data-v-0b619cf4>OK</button></label> <div class="footer" style="display:none;" data-v-0b619cf4 data-v-0b619cf4><span data-v-0b619cf4><i class="iconfont reco-theme" data-v-0b619cf4></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-0b619cf4>vuePress-theme-reco</a></span> <span data-v-0b619cf4><i class="iconfont reco-copyright" data-v-0b619cf4></i> <a data-v-0b619cf4><span data-v-0b619cf4>LJoson</span>
            
          <span data-v-0b619cf4>2020 - </span>
          2025
        </a></span></div></div> <div class="hide" data-v-4d80cb8a><header class="navbar" data-v-4d80cb8a><div title="导航" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">GLIMMER小作坊的工具人</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/index.html" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/AI及机器人等/" class="nav-link"><i class="iconfont undefined"></i>
  AI及机器人等
</a></li><li class="dropdown-item"><!----> <a href="/categories/算法等/" class="nav-link"><i class="iconfont undefined"></i>
  算法等
</a></li><li class="dropdown-item"><!----> <a href="/categories/计算机技术等/" class="nav-link"><i class="iconfont undefined"></i>
  计算机技术等
</a></li><li class="dropdown-item"><!----> <a href="/categories/电子设计等/" class="nav-link"><i class="iconfont undefined"></i>
  电子设计等
</a></li><li class="dropdown-item"><!----> <a href="/categories/杂谈/" class="nav-link"><i class="iconfont undefined"></i>
  杂谈
</a></li><li class="dropdown-item"><!----> <a href="/categories/游戏设计等/" class="nav-link"><i class="iconfont undefined"></i>
  游戏设计等
</a></li><li class="dropdown-item"><!----> <a href="/categories/笔记等/" class="nav-link"><i class="iconfont undefined"></i>
  笔记等
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-document"></i>
      我的
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>Projects🎈</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/projects/github.html" class="nav-link"><i class="iconfont undefined"></i>
  Project on github
</a></li></ul></li><li class="dropdown-item"><h4>Station🎈</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="https://github.com/LJoson" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  GitHub
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-subitem"><a href="https://blog.csdn.net/qq_43743037" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  CSDN
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></li></ul></div></div><div class="nav-item"><a href="/timeLine/index.html" class="nav-link"><i class="iconfont reco-date"></i>
  时间线
</a></div><div class="nav-item"><a href="https://ljoson.github.io/arXiv_daily" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-document"></i>
  每日论文摘要
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="/about/aboutme.html" class="nav-link"><i class="iconfont reco-message"></i>
  关于坊主
</a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-4d80cb8a></div> <aside class="sidebar" data-v-4d80cb8a><div class="personal-info-wrapper" data-v-79645776><img src="/vuepress/Headimage.jpg" alt="author-avatar" class="personal-img" data-v-79645776> <h3 class="name" data-v-79645776>
    LJoson
  </h3> <div class="num" data-v-79645776><div data-v-79645776><h3 data-v-79645776>105</h3> <h6 data-v-79645776>文章</h6></div> <div data-v-79645776><h3 data-v-79645776>49</h3> <h6 data-v-79645776>标签</h6></div></div> <hr data-v-79645776></div> <nav class="nav-links"><div class="nav-item"><a href="/index.html" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/AI及机器人等/" class="nav-link"><i class="iconfont undefined"></i>
  AI及机器人等
</a></li><li class="dropdown-item"><!----> <a href="/categories/算法等/" class="nav-link"><i class="iconfont undefined"></i>
  算法等
</a></li><li class="dropdown-item"><!----> <a href="/categories/计算机技术等/" class="nav-link"><i class="iconfont undefined"></i>
  计算机技术等
</a></li><li class="dropdown-item"><!----> <a href="/categories/电子设计等/" class="nav-link"><i class="iconfont undefined"></i>
  电子设计等
</a></li><li class="dropdown-item"><!----> <a href="/categories/杂谈/" class="nav-link"><i class="iconfont undefined"></i>
  杂谈
</a></li><li class="dropdown-item"><!----> <a href="/categories/游戏设计等/" class="nav-link"><i class="iconfont undefined"></i>
  游戏设计等
</a></li><li class="dropdown-item"><!----> <a href="/categories/笔记等/" class="nav-link"><i class="iconfont undefined"></i>
  笔记等
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-document"></i>
      我的
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>Projects🎈</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/projects/github.html" class="nav-link"><i class="iconfont undefined"></i>
  Project on github
</a></li></ul></li><li class="dropdown-item"><h4>Station🎈</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="https://github.com/LJoson" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  GitHub
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li><li class="dropdown-subitem"><a href="https://blog.csdn.net/qq_43743037" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont undefined"></i>
  CSDN
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></li></ul></div></div><div class="nav-item"><a href="/timeLine/index.html" class="nav-link"><i class="iconfont reco-date"></i>
  时间线
</a></div><div class="nav-item"><a href="https://ljoson.github.io/arXiv_daily" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-document"></i>
  每日论文摘要
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="/about/aboutme.html" class="nav-link"><i class="iconfont reco-message"></i>
  关于坊主
</a></div> <!----></nav>  <ul class="sidebar-links"><li><a href="/views/" class="sidebar-link">概览</a></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>AI及机器人等</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>算法等</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>计算机技术等</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>硬件及运动控制等</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>杂谈</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/views/freetalk/why.html" class="sidebar-link">尽情奔跑，砥砺前行</a></li><li><a href="/views/freetalk/color.html" class="sidebar-link">浅谈图像颜色空间及相互变换</a></li><li><a href="/views/freetalk/Fourier.html" class="active sidebar-link">一个有趣的傅里叶动画</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/views/freetalk/Fourier.html#工具环境" class="sidebar-link">工具环境</a></li><li class="sidebar-sub-header"><a href="/views/freetalk/Fourier.html#图像边缘提取" class="sidebar-link">图像边缘提取</a></li><li class="sidebar-sub-header"><a href="/views/freetalk/Fourier.html#代码分析" class="sidebar-link">代码分析</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/views/freetalk/Fourier.html#findcontours函数" class="sidebar-link">findContours函数</a></li></ul></li></ul></li><li><a href="/views/freetalk/android.html" class="sidebar-link">Android端模型部署</a></li><li><a href="/views/freetalk/ip0.html" class="sidebar-link">TCP/IP初识</a></li><li><a href="/views/freetalk/picgo.html" class="sidebar-link">PicGo+typora搭建在线图床</a></li><li><a href="/views/freetalk/docker00.html" class="sidebar-link">win10家庭版安装Docker及使用</a></li><li><a href="/views/freetalk/self_improvement.html" class="sidebar-link">自我驱动，自我提升</a></li><li><a href="/views/freetalk/cicd/fix.html" class="sidebar-link">CI/CD自动化集成测试部署</a></li><li><a href="/views/freetalk/spider/github.html" class="sidebar-link">github数据分析</a></li><li><a href="/views/freetalk/spider/zhihu.html" class="sidebar-link">知乎爬虫</a></li><li><a href="/views/freetalk/vsc/tools.html" class="sidebar-link">vscode常用小插件</a></li><li><a href="/views/freetalk/wsl2/wsl.html" class="sidebar-link">在Windows10上用WSL/WSL2优雅开发</a></li><li><a href="/views/freetalk/wsl2/note.html" class="sidebar-link">WSL/WSL2优雅开发实录</a></li><li><a href="/views/freetalk/wsl2/wslg.html" class="sidebar-link">WSL2 系统上运行 Linux GUI 应用</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>小游戏设计等</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>笔记等</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-0b619cf4 data-v-4d80cb8a><h3 class="title" style="display:none;" data-v-0b619cf4 data-v-0b619cf4>一个有趣的傅里叶动画</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-0b619cf4 data-v-0b619cf4><input type="password" value="" data-v-0b619cf4> <span data-v-0b619cf4>Konck! Knock!</span> <button data-v-0b619cf4>OK</button></label> <div class="footer" style="display:none;" data-v-0b619cf4 data-v-0b619cf4><span data-v-0b619cf4><i class="iconfont reco-theme" data-v-0b619cf4></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-0b619cf4>vuePress-theme-reco</a></span> <span data-v-0b619cf4><i class="iconfont reco-copyright" data-v-0b619cf4></i> <a data-v-0b619cf4><span data-v-0b619cf4>LJoson</span>
            
          <span data-v-0b619cf4>2020 - </span>
          2025
        </a></span></div></div> <div data-v-4d80cb8a><main class="page"><!----> <div class="page-title" style="display:none;"><h1>一个有趣的傅里叶动画</h1> <hr> <div data-v-09556aba><i class="iconfont reco-account" data-v-09556aba><span data-v-09556aba>LJoson</span></i> <i class="iconfont reco-date" data-v-09556aba><span data-v-09556aba>2020-09-30 20:41:12</span></i> <i class="iconfont reco-eye" data-v-09556aba><span id="/views/freetalk/Fourier.html" data-flag-title="Your Article Title" class="leancloud-visitors" data-v-09556aba><a class="leancloud-visitors-count" style="font-size:.9rem;font-weight:normal;color:#999;"></a></span></i> <i class="iconfont reco-tag tags" data-v-09556aba><span class="tag-item" data-v-09556aba>
      前端动画
    </span></i></div></div> <div class="theme-reco-content content__default" style="display:none;"><p></p><div class="table-of-contents"><ul><li><a href="#工具环境">工具环境</a></li><li><a href="#图像边缘提取">图像边缘提取</a></li><li><a href="#代码分析">代码分析</a><ul><li><a href="#findcontours函数">findContours函数</a></li></ul></li></ul></div><p></p> <h1 id="引言"><a href="#引言" class="header-anchor">#</a> 引言</h1> <p>在网络上看到一个关于一个傅里叶变换实现动画描绘的文章， <a href="https://mp.weixin.qq.com/s/57WKK0xEBti9BjUD1xVlRQ" target="_blank" rel="noopener noreferrer">一个有趣的傅里叶动画<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>，觉得很有意思，并进行了复现。由于前端动画篇幅太多，下面简单展示了关于图像边缘提取的部分。</p> <h2 id="工具环境"><a href="#工具环境" class="header-anchor">#</a> 工具环境</h2> <ul><li>opencv4.2+vs2017</li> <li>vscode</li></ul> <p><a href="https://github.com/LJoson/Fourier_cartoon" target="_blank" rel="noopener noreferrer">完整工程代码<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <h2 id="图像边缘提取"><a href="#图像边缘提取" class="header-anchor">#</a> 图像边缘提取</h2> <div class="language-cpp line-numbers-mode"><pre class="language-cpp"><code><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">&lt;opencv2/opencv.hpp&gt;</span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">&lt;opencv2/imgproc/types_c.h&gt;</span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;opencv2/core.hpp&gt;</span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;opencv2/highgui.hpp&gt;</span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;iostream&gt;</span> </span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;fstream&gt;</span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;math.h&gt;</span></span>
<span class="token keyword">using</span> <span class="token keyword">namespace</span> cv<span class="token punctuation">;</span>
<span class="token keyword">using</span> <span class="token keyword">namespace</span> std<span class="token punctuation">;</span>
<span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">{</span>
	Mat src <span class="token operator">=</span> <span class="token function">imread</span><span class="token punctuation">(</span><span class="token string">&quot;640.png&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
	Mat grayImage<span class="token punctuation">;</span>
	<span class="token function">cvtColor</span><span class="token punctuation">(</span>src<span class="token punctuation">,</span> grayImage<span class="token punctuation">,</span> CV_BGR2GRAY<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//灰度处理</span>
	<span class="token function">GaussianBlur</span><span class="token punctuation">(</span>grayImage<span class="token punctuation">,</span> grayImage<span class="token punctuation">,</span> <span class="token function">Size</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//高斯模糊处理</span>
	<span class="token function">threshold</span><span class="token punctuation">(</span>grayImage<span class="token punctuation">,</span> grayImage<span class="token punctuation">,</span> <span class="token number">128</span><span class="token punctuation">,</span> <span class="token number">255</span><span class="token punctuation">,</span> CV_THRESH_BINARY<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//二值化处理</span>
	Mat cannyImage<span class="token punctuation">;</span>
	<span class="token function">Canny</span><span class="token punctuation">(</span>grayImage<span class="token punctuation">,</span> cannyImage<span class="token punctuation">,</span> <span class="token number">128</span><span class="token punctuation">,</span> <span class="token number">255</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    <span class="token comment">//提取边缘算子</span>
	vector<span class="token operator">&lt;</span>vector<span class="token operator">&lt;</span>Point<span class="token operator">&gt;&gt;</span> contours<span class="token punctuation">;</span>
	vector<span class="token operator">&lt;</span>Vec4i<span class="token operator">&gt;</span> hierarchy<span class="token punctuation">;</span>
	<span class="token comment">//contours为输出的轮廓数据集合</span>
	<span class="token function">findContours</span><span class="token punctuation">(</span>cannyImage<span class="token punctuation">,</span> contours<span class="token punctuation">,</span> hierarchy<span class="token punctuation">,</span> CV_RETR_LIST<span class="token punctuation">,</span> CV_CHAIN_APPROX_NONE<span class="token punctuation">,</span> <span class="token function">Point</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token comment">//findContours(grayImage, contours, hierarchy, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, Point(0, 0));</span>
	<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> contours<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
	<span class="token punctuation">{</span>
		<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> j <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> j <span class="token operator">&lt;</span> contours<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> j<span class="token operator">++</span><span class="token punctuation">)</span>
		<span class="token punctuation">{</span>
			cout <span class="token operator">&lt;&lt;</span> contours<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>x <span class="token operator">&lt;&lt;</span> <span class="token string">&quot;, &quot;</span> <span class="token operator">&lt;&lt;</span> contours<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>y <span class="token operator">&lt;&lt;</span> <span class="token string">&quot;, &quot;</span><span class="token punctuation">;</span>
			ofstream f<span class="token punctuation">;</span>
			f<span class="token punctuation">.</span><span class="token function">open</span><span class="token punctuation">(</span><span class="token string">&quot;640.txt&quot;</span><span class="token punctuation">,</span> ios<span class="token operator">::</span>out <span class="token operator">|</span> ios<span class="token operator">::</span>app<span class="token punctuation">)</span><span class="token punctuation">;</span>
			f <span class="token operator">&lt;&lt;</span> contours<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>x <span class="token operator">&lt;&lt;</span> <span class="token string">&quot;, &quot;</span> <span class="token operator">&lt;&lt;</span> contours<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>y <span class="token operator">&lt;&lt;</span> <span class="token string">&quot;, &quot;</span><span class="token punctuation">;</span>
		<span class="token punctuation">}</span>
	<span class="token punctuation">}</span>
	Mat imageContours <span class="token operator">=</span> <span class="token class-name">Mat</span><span class="token operator">::</span><span class="token function">zeros</span><span class="token punctuation">(</span>src<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> CV_8UC1<span class="token punctuation">)</span><span class="token punctuation">;</span>
	Mat Contours <span class="token operator">=</span> <span class="token class-name">Mat</span><span class="token operator">::</span><span class="token function">zeros</span><span class="token punctuation">(</span>src<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> CV_8UC1<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//绘制</span>
	<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> contours<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
	<span class="token punctuation">{</span>
		<span class="token comment">//contours[i]代表的是第i个轮廓，contours[i].size()代表的是第i个轮廓上所有的像素点数</span>
		<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> j <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> j <span class="token operator">&lt;</span> contours<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> j<span class="token operator">++</span><span class="token punctuation">)</span>
		<span class="token punctuation">{</span>
			<span class="token comment">//绘制出contours向量内所有的像素点</span>
			Point P <span class="token operator">=</span> <span class="token function">Point</span><span class="token punctuation">(</span>contours<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>x<span class="token punctuation">,</span> contours<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>y<span class="token punctuation">)</span><span class="token punctuation">;</span>
			Contours<span class="token punctuation">.</span>at<span class="token operator">&lt;</span>uchar<span class="token operator">&gt;</span><span class="token punctuation">(</span>P<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">255</span><span class="token punctuation">;</span>
		<span class="token punctuation">}</span>

		<span class="token comment">//输出hierarchy向量内容</span>
		<span class="token keyword">char</span> ch<span class="token punctuation">[</span><span class="token number">256</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
		<span class="token function">sprintf_s</span><span class="token punctuation">(</span>ch<span class="token punctuation">,</span> <span class="token string">&quot;%d&quot;</span><span class="token punctuation">,</span> i<span class="token punctuation">)</span><span class="token punctuation">;</span>
		string str <span class="token operator">=</span> ch<span class="token punctuation">;</span>
		cout <span class="token operator">&lt;&lt;</span> <span class="token string">&quot;向量hierarchy的第&quot;</span> <span class="token operator">&lt;&lt;</span> str <span class="token operator">&lt;&lt;</span> <span class="token string">&quot; 个元素内容为：&quot;</span> <span class="token operator">&lt;&lt;</span> endl <span class="token operator">&lt;&lt;</span> hierarchy<span class="token punctuation">[</span>i<span class="token punctuation">]</span> <span class="token operator">&lt;&lt;</span> endl <span class="token operator">&lt;&lt;</span> endl<span class="token punctuation">;</span>

		<span class="token comment">//绘制轮廓</span>
		<span class="token function">drawContours</span><span class="token punctuation">(</span>imageContours<span class="token punctuation">,</span> contours<span class="token punctuation">,</span> i<span class="token punctuation">,</span> <span class="token function">Scalar</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">,</span> hierarchy<span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token punctuation">}</span>
	<span class="token function">imshow</span><span class="token punctuation">(</span><span class="token string">&quot;Contours Image&quot;</span><span class="token punctuation">,</span> imageContours<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//轮廓</span>
	<span class="token function">imshow</span><span class="token punctuation">(</span><span class="token string">&quot;Point of Contours&quot;</span><span class="token punctuation">,</span> Contours<span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//向量contours内保存的所有轮廓点集</span>
	<span class="token function">waitKey</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

	<span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>


</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br></div></div><h2 id="代码分析"><a href="#代码分析" class="header-anchor">#</a> 代码分析</h2> <h3 id="findcontours函数"><a href="#findcontours函数" class="header-anchor">#</a> findContours函数</h3> <ul><li>原型</li></ul> <div class="language- line-numbers-mode"><pre class="language-text"><code>findContours( InputOutputArray image, OutputArrayOfArrays contours,
                              OutputArray hierarchy, int mode,
                              int method, Point offset=Point());

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><ul><li><p>第一个参数：image，单通道图像矩阵，可以是灰度图，但更常用的是二值图像，一般是经过Canny、拉普拉斯等边缘检测算子处理过的二值图像；</p></li> <li><p>第二个参数：contours，定义为“vector&lt;vector<Point>&gt; contours”，是一个向量，并且是一个双重向量，向量内每个元素保存了一组由连续的Point点构成的点的集合的向量，每一组Point点集就是一个轮廓。有多少轮廓，向量contours就有多少元素。</Point></p></li> <li><p>第三个参数：hierarchy，定义为“vector<Vec4i> hierarchy”，先来看一下Vec4i的定义：</Vec4i></p></li></ul> <div class="language- line-numbers-mode"><pre class="language-text"><code>typedef    Vec&lt;int, 4&gt;   Vec4i;                                                                       
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><div class="custom-block tip"><p>Vec4i是Vec&lt;int,4&gt;的别名，定义了一个“向量内每一个元素包含了4个int型变量”的向量。所以从定义上看，hierarchy也是一个向量，向量内每个元素保存了一个包含4个int整型的数组。向量hiararchy内的元素和轮廓向量contours内的元素是一一对应的，向量的容量相同。 hierarchy向量内每一个元素的4个int型变量——hierarchy[i][0] ~hierarchy[i][3]，分别表示第i个轮廓的后一个轮廓、前一个轮廓、父轮廓、内嵌轮廓的索引编号。如果当前轮廓没有对应的后一个轮廓、前一个轮廓、父轮廓或内嵌轮廓的话，则hierarchy[i][0] ~hierarchy[i][3]的相应位被设置为默认值-1。</p></div> <ul><li>第四个参数：int型的mode，定义轮廓的检索模式：</li></ul> <div class="custom-block tip"><p>取值一：CV_RETR_EXTERNAL只检测最外围轮廓，包含在外围轮廓内的内围轮廓被忽略</p> <p>取值二：CV_RETR_LIST   检测所有的轮廓，包括内围、外围轮廓，但是检测到的轮廓不建立等级关系，彼此之间独立，没有等级关系，这就意味着这个检索模式下不存在父轮廓或内嵌轮廓，所以hierarchy向量内所有元素的第3、第4个分量都会被置为-1。</p> <p>取值三：CV_RETR_CCOMP  检测所有的轮廓，但所有轮廓只建立两个等级关系，外围为顶层，若外围内的内围轮廓还包含了其他的轮廓信息，则内围内的所有轮廓均归属于顶层</p> <p>取值四：CV_RETR_TREE， 检测所有轮廓，所有轮廓建立一个等级树结构。外层轮廓包含内层轮廓，内层轮廓还可以继续包含内嵌轮廓。</p></div> <p>第五个参数：int型的method，定义轮廓的近似方法：
:::</p> <p>取值一：CV_CHAIN_APPROX_NONE 保存物体边界上所有连续的轮廓点到contours向量内</p> <p>取值二：CV_CHAIN_APPROX_SIMPLE 仅保存轮廓的拐点信息，把所有轮廓拐点处的点保存入contours  向量内，拐点与拐点之间直线段上的信息点不予保留</p> <p>取值三和四：CV_CHAIN_APPROX_TC89_L1，CV_CHAIN_APPROX_TC89_KCOS使用teh-Chinl chain 近 似算法</p> <p>:::</p> <p>第六个参数：Point偏移量，所有的轮廓信息相对于原始图像对应点的偏移量，相当于在每一个检测出的轮廓点上加上该偏移量，并且Point还可以是负值！</p> <div class="custom-block tip"><p class="custom-block-title">参考</p> <p>https://www.stubbornhuang.com/441/</p></div></div> <footer class="page-edit" style="display:none;"><!----> <div class="last-updated"><span class="prefix">最后更新时间: </span> <span class="time">2023/01/13, 20:39:48</span></div></footer> <!----> <!----> <div class="article-list" data-v-61e7bf3a><div class="article-title" data-v-61e7bf3a><a href="/timeline/" class="iconfont icon-shizhong" data-v-61e7bf3a>最近更新</a></div> <div class="article-wrapper" data-v-61e7bf3a><dl data-v-61e7bf3a><dd data-v-61e7bf3a>01</dd> <dt data-v-61e7bf3a><a href="/views/AI/ebot/ebot1.html" data-v-61e7bf3a><div data-v-61e7bf3a>技术随笔《二》：人形机器人模仿学习与传统控制方法概述</div></a> <span data-v-61e7bf3a>04-12</span></dt></dl><dl data-v-61e7bf3a><dd data-v-61e7bf3a>02</dd> <dt data-v-61e7bf3a><a href="/views/AI/ebot/ebot0.html" data-v-61e7bf3a><div data-v-61e7bf3a>技术随笔《一》：人形机器人控制算法概述</div></a> <span data-v-61e7bf3a>04-10</span></dt></dl><dl data-v-61e7bf3a><dd data-v-61e7bf3a>03</dd> <dt data-v-61e7bf3a><a href="/views/AI/coder/" data-v-61e7bf3a><div data-v-61e7bf3a>编解码器详解</div></a> <span data-v-61e7bf3a>12-26</span></dt></dl></div> <div data-v-61e7bf3a><a href="/timeline/" class="article-more" data-v-61e7bf3a>更多文章 &gt;</a></div></div></main> <!----> <div class="comments-wrapper" data-v-4d80cb8a><div class="valine-wrapper"><div id="valine"></div></div></div></div></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-a81d141e data-v-a81d141e><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-a81d141e><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-a81d141e></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-a81d141e></path></svg></div><!----><div data-v-4a66ed39><div class="DetailsOpenFlag" style="right:1rem;bottom:9rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;font-size:14px;font-weight:500;display:none;" data-v-4a66ed39>
 展开

</div></div><div class="kanbanniang" data-v-3c101199><div class="banniang-container" style="display:;" data-v-3c101199><div class="messageBox" style="right:68px;bottom:190px;display:none;" data-v-3c101199>
      欢迎来到 GLIMMER小作坊的工具人
    </div> <div class="operation" style="right:90px;bottom:40px;display:;" data-v-3c101199><i class="kbnfont kbn-ban-home ban-home" data-v-3c101199></i> <i class="kbnfont kbn-ban-message message" data-v-3c101199></i> <i class="kbnfont kbn-ban-close close" data-v-3c101199></i> <a target="_blank" href="https://vuepress-theme-reco.recoluan.com/views/plugins/kanbanniang.html" data-v-3c101199><i class="kbnfont kbn-ban-info info" data-v-3c101199></i></a> <i class="kbnfont kbn-ban-theme skin" style="display:;" data-v-3c101199></i></div> <canvas id="banniang" width="150" height="220" class="live2d" style="right:90px;bottom:-20px;opacity:0.9;" data-v-3c101199></canvas></div> <div class="showBanNiang" style="display:none;" data-v-3c101199>
    看板娘
  </div></div></div></div>
    <script src="/assets/js/app.c1719760.js" defer></script><script src="/assets/js/5.882ae477.js" defer></script><script src="/assets/js/1.ad2741e3.js" defer></script><script src="/assets/js/2.b0f5b6a6.js" defer></script><script src="/assets/js/98.7bb55507.js" defer></script><script src="/assets/js/20.a8dae886.js" defer></script>
  </body>
</html>
